<template>
  <div class="app-container">
    <div class="search-container">
      <el-form :model="searchParam" :inline="true" label-width="100px">
        <el-form-item label="外部编号">
          <el-input
            v-model="searchParam.extenalCode"
            placeholder="请输入外部编号"
            clearable
            @keyup.enter="search"
          />
        </el-form-item>
        <div v-if="isExpanded">
          <el-form-item label="物料号">
            <el-input
              v-model="searchParam.materialCode"
              placeholder="请输入物料号"
              clearable
              @keyup.enter="search"
            />
          </el-form-item>

          <el-form-item label="包装物物料号">
            <el-input
              v-model="searchParam.packageMaterialCode"
              placeholder="请输入包装物物料号"
              clearable
              @keyup.enter="search"
            />
          </el-form-item>

          <el-form-item label="存储批次">
            <el-input
              v-model="searchParam.stockBatch"
              placeholder="请输入存储批次"
              clearable
              @keyup.enter="search"
            />
          </el-form-item>
          <el-form-item label="供应批次">
            <el-input
              v-model="searchParam.supplyBatch"
              placeholder="请输入供应批次"
              clearable
              @keyup.enter="search"
            />
          </el-form-item>

          <el-form-item label="公司编号">
            <el-input
              v-model="searchParam.organizationCode"
              placeholder="请输入公司编号"
              clearable
              @keyup.enter="search"
            />
          </el-form-item>

          <el-form-item label="工厂">
            <el-select
              v-model="searchParam.plantId"
              placeholder="请选择所在工厂"
              clearable
            >
              <el-option
                v-for="item in plantList"
                :key="item.id"
                :label="item.organizationCode"
                :value="item.id"
              />
            </el-select>
          </el-form-item>

          <el-form-item label="仓库号">
            <el-input
              v-model="searchParam.warehouseCode"
              placeholder="请输入仓库号"
              clearable
              @keyup.enter="search"
            />
          </el-form-item>

          <el-form-item label="存储地点编号">
            <el-input
              v-model="searchParam.storageLocationCode"
              placeholder="请输入存储地点编号"
              clearable
              @keyup.enter="search"
            />
          </el-form-item>

          <el-form-item label="存储类型号">
            <el-input
              v-model="searchParam.storageTypeCode"
              placeholder="请输入存储类型号"
              clearable
              @keyup.enter="search"
            />
          </el-form-item>

          <el-form-item label="存储区号">
            <el-input
              v-model="searchParam.storageSectionCode"
              placeholder="请输入存储区号"
              clearable
              @keyup.enter="search"
            />
          </el-form-item>

          <el-form-item label="仓位编号">
            <el-input
              v-model="searchParam.binCode"
              placeholder="请输入仓位编号"
              clearable
              @keyup.enter="search"
            />
          </el-form-item>

          <el-form-item label="创建时间">
            <el-date-picker
              v-model="searchParam.createTimeSearch"
              type="datetimerange"
              range-separator="至"
              start-placeholder="开始日期"
              end-placeholder="结束日期"
              value-format="YYYY-MM-DD HH:mm:ss"
              @change="getcreateTime"
            />
          </el-form-item>

          <el-form-item label="创建人">
            <el-input
              v-model="searchParam.createdUserName"
              placeholder="请输入创建人"
              clearable
              @keyup.enter="search"
            />
          </el-form-item>
        </div>
        <el-form-item>
          <el-button type="primary" @click="search"
            ><i-ep-search />搜索</el-button
          >
          <el-button @click="reset"><i-ep-refresh />重置</el-button>
          <el-button
            class="ml-3"
            @click="
              useDownload(
                '/wms/storageunit/export',
                '包装库存',
                searchParam,
                true,
                '.xls'
              )
            "
          >
            <template #icon><i-ep-download /></template>导出</el-button
          >
          <el-button type="primary" @click="toggleSearchArea" link>
            {{ isExpanded ? "收起" : "展开" }}
            <el-icon v-if="isExpanded" class="el-icon--right">
              <i-ep-arrowUp color="#409EFC" />
            </el-icon>
            <el-icon v-else class="el-icon--right">
              <i-ep-arrowDown color="#409EFC" />
            </el-icon>
          </el-button>
        </el-form-item>
      </el-form>
    </div>

    <el-card shadow="never" class="table-container">
      <template #header> </template>

      <el-table
        ref="dataTableRef"
        v-loading="loading"
        :data="tableData"
        highlight-current-row
        border
        @selection-change="handleSelectionChange"
      >
        <el-table-column type="selection" width="55" align="center" />
        <el-table-column label="外部编号" prop="extenalCode" min-width="150" />
        <el-table-column
          label="物料"
          prop="materialCode"
          min-width="160"
          show-overflow-tooltip
        >
          <template #default="scope">
            {{ scope.row.materialCode }} - {{ scope.row.materialName }}
          </template>
        </el-table-column>
        <el-table-column label="采购订单号" prop="remarks" min-width="150" />
        <el-table-column
          label="包装物物料号"
          prop="packageMaterialCode"
          min-width="130"
        />
        <el-table-column
          label="包装物物料名称"
          prop="packageMaterialName"
          min-width="130"
        />
        <el-table-column label="存储批次" prop="stockBatch" min-width="100" />
        <el-table-column label="供应批次" prop="supplyBatch" min-width="150" />

        <el-table-column
          label="公司编号"
          prop="organizationCode"
          min-width="100"
        />
        <el-table-column
          label="公司名称"
          prop="organizationName"
          min-width="200"
        />

        <el-table-column label="工厂" prop="plantCode" width="100" />

        <el-table-column label="仓库号" prop="warehouseCode" min-width="100" />
        <el-table-column
          label="仓库名称"
          prop="warehouseName"
          min-width="200"
        />

        <el-table-column
          label="存储地点编号"
          prop="storageLocationCode"
          min-width="120"
        />
        <el-table-column
          label="存储地点名称"
          prop="storageLocationName"
          min-width="150"
        />

        <el-table-column
          label="存储类型号"
          prop="storageTypeCode"
          min-width="100"
        />
        <el-table-column
          label="存储类型名称"
          prop="storageTypeName"
          min-width="200"
        />

        <el-table-column
          label="存储区号"
          prop="storageSectionCode"
          min-width="100"
        />

        <el-table-column label="仓位编号" prop="binCode" min-width="120" />
        <el-table-column label="总数量" prop="totalQuantity" min-width="100" />
        <el-table-column
          label="可用数量"
          prop="availableQuantity"
          min-width="100"
        />
        <el-table-column
          label="限制使用数量"
          prop="freezeQuantity"
          min-width="120"
        />
        <el-table-column label="数量单位" prop="quantityUnit" min-width="100" />
        <el-table-column label="占用容积" prop="usedColume" min-width="100" />
        <el-table-column label="占用面积" prop="usedArea" min-width="100" />
        <el-table-column label="占用载重量" prop="usedWeight" min-width="100" />

        <!--<el-table-column label="备注" prop="remarks" min-width="300" />-->
        <el-table-column label="创建时间" prop="createTime" min-width="160" />

        <el-table-column
          label="创建人"
          prop="createdUserName"
          min-width="100"
        />
        <el-table-column
          label="修改时间"
          prop="lastUpdateTime"
          min-width="160"
        />

        <el-table-column
          label="修改人"
          prop="lastUpdatedUserName"
          min-width="100"
        />
        <el-table-column fixed="right" label="操作" width="120" align="center">
          <template #default="scope">
            <el-button
              type="primary"
              size="small"
              link
              @click="openDialogdetail(scope.row)"
            >
              <i-ep-edit />
              查看
            </el-button>
            <el-button
              style="color: #409eff"
              type="success"
              size="small"
              link
              @click="open(scope.row)"
            >
              打印
            </el-button>
          </template>
        </el-table-column>
      </el-table>

      <el-pagination
        :background="true"
        :current-page="pageable.pageNum"
        :page-size="pageable.pageSize"
        :page-sizes="[10, 25, 50, 100]"
        :total="pageable.total"
        layout="total, sizes, prev, pager, next, jumper"
        class="mt-[20px]"
        @size-change="handleSizeChange"
        @current-change="handleCurrentChange"
      />
    </el-card>

    <wmsstorageunitquery-edit
      :visible="addDialog.visible"
      :title="addDialog.title"
      :data="addDialog.data"
      @reset-table="reset"
      @change-visible="changeVisible"
    />
    <iframe
      v-if="showWebView"
      :src="webviewSrc"
      :update-title="false"
      style="width: 0; height: 0"
    ></iframe>
    <!--    打印-->
    <div id="printBox" v-if="isPrint" style="opacity: 0">
      <div
        style="margin-bottom: 20px"
        v-for="item in printData"
        :key="item?.id"
      >
        <div
          :id="`printId_${item?.id || ''}`"
          style="width: 384px; height: 394px"
        >
          <!-- &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; -->
          <!-- <canvas :id="`barcode_${item?.id || ''}`"></canvas> -->
          <div
            style="
              font-size: 12px;
              font-weight: 600;
              word-break: break-all;
              width: 360px;
            "
          >
            <span style="font-size: 18px; font-weight: 100; width: 80%"
              ><text style="font-size: 18px; font-weight: 500">{{
                item?.extenalCode || ""
              }}</text></span
            >
          </div>
          <div style="font-size: 14px; margin-bottom: -10px; width: 360px">
            <span style="font-size: 18px; margin-right: 20px; font-weight: 600"
              >存货编码：&nbsp;<text
                style="font-size: 20px; font-weight: 600; margin-right: 20px"
                >{{ item?.materialCode || "" }}</text
              ></span
            >
            <span
              style="font-size: 18px; font-weight: 600; word-break: break-all"
              >材质：<span
                style="font-size: 20px; font-weight: 600; word-break: break-all"
                >{{ item?.materialQuality || "" }}</span
              ></span
            >
          </div>
          <div style="font-size: 14px; margin-bottom: -10px; width: 390px">
            <br />
            <span
              style="
                font-size: 18px;
                font-weight: 100;
                margin-right: 20px;
                font-weight: 600;
              "
              >规格型号：&nbsp;<text
                style="font-size: 20px; font-weight: 600"
                >{{ item?.materialSpecification || "" }}</text
              ></span
            >
          </div>
          <div style="font-size: 14px; margin-bottom: -10px; width: 390px">
            <br />
            <span
              style="
                font-size: 18px;
                font-weight: 100;
                margin-right: 20px;
                font-weight: 600;
              "
              >图号：&nbsp;<text style="font-size: 20px; font-weight: 600">{{
                item?.figureNumber || ""
              }}</text></span
            >
          </div>
          <div style="font-size: 14px; margin-bottom: 0px; width: 390px">
            <br /><span
              style="
                font-size: 18px;
                font-weight: 100;
                margin-right: 10px;
                font-weight: 600;
              "
              >生产批次：<text
                style="font-size: 20px; font-weight: 600; margin-right: 10px"
                >{{ item?.supplyBatch || "" }}</text
              ></span
            >
            <span
              style="
                font-size: 18px;
                font-weight: 100;
                margin-right: 20px;
                font-weight: 600;
              "
              >数量：&nbsp;<text style="font-size: 20px; font-weight: 600"
                >{{ item?.totalQuantity || "" }}
                {{ item?.unitName || "" }}</text
              >
            </span>
          </div>
          <div style="height: 5px"></div>
          <div style="font-size: 12px; width: 390px; margin-bottom: 1px">
            <span
              style="
                font-size: 12px;
                font-weight: 100;
                margin-right: 20px;
                font-weight: 600;
              "
              >打印时间：&nbsp;<text>{{ item?.createTime || "" }}</text></span
            >
            <span
              style="
                font-size: 12px;
                font-weight: 100;
                margin-right: 20px;
                font-weight: 600;
              "
              >打印人：&nbsp;<text
                >{{ item?.createdUserName || "" }}&nbsp;</text
              ></span
            >
          </div>
          <div style="height: 5px"></div>
          <div style="font-size: 14px; width: 400px; display: flex">
            <span
              style="
                flex: 1;
                font-weight: 100;
                font-size: 14px;
                margin-right: 20px;

                font-weight: 600;
              "
              >操作者1：&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span
            >
            <span
              style="
                flex: 1;
                font-weight: 100;
                font-size: 14px;
                margin-right: 20px;

                font-weight: 600;
              "
              >操作者2：&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span
            >
            <span
              style="
                flex: 1;
                font-weight: 100;
                font-size: 14px;
                margin-right: 20px;

                font-weight: 600;
              "
              >检&nbsp;查：&nbsp;&nbsp;&nbsp;&nbsp;</span
            >
          </div>
          <div
            style="
              font-size: 17px;
              margin-bottom: 0px;
              width: 300px;
              font-weight: 600;
            "
          ></div>
        </div>
        <div style="margin-top: 500px; text-align: center">
          <div style="display: flex; justify-content: center; gap: 10px">
            <el-button size="small" @click="getPrintData()">打印</el-button>
            <el-button size="small" @click="isPrint = false">返回</el-button>
          </div>
        </div>
      </div>
    </div>
    <el-button
      plain
      @click="centerDialogVisible = true"
      style="margin-bottom: 10px"
    >
      打印设置
    </el-button>

    <el-dialog
      :close-on-click-modal="false"
      v-model="centerDialogVisible"
      title="打印设置"
      width="300"
      center
    >
      <el-radio-group
        v-model="flag"
        style="display: flex; justify-content: center; align-items: center"
      >
        <el-radio label="distant">远程打印</el-radio>
        <el-radio label="local">本地打印</el-radio>
      </el-radio-group>
      <template #footer>
        <div class="dialog-footer">
          <el-button @click="centerDialogVisible = false">取消</el-button>
          <el-button type="primary" @click="centerDialogVisibleClick">
            确定
          </el-button>
        </div>
      </template>
    </el-dialog>
  </div>
</template>

<script setup lang="ts">
import { useTable, useDownload, useDictionary } from "@/utils/useTable";
import request from "@/utils/request";
import { RootObject } from "@/views/demo/iframePrintUnit/index";
import { getLodop } from "@/utils/LodopFuncs";

defineOptions({
  name: "WMSSTORAGEUNITQUERYDEMO",
  inheritAttrs: false,
});
// 请求参数
const requestApi = "/wms/storageunit/queryByPage";

// 是否需要分页
const pagination = true;

const initParam = {
  sort: {
    column: "last_update_time",
    orderBy: "desc",
  },
};
const plantList: any = ref([]);
const getPlantList = async () => {
  const res1 = await request({
    url: "system/sysOrganization/getList",
    method: "post",
    data: { organizationType: 3 },
  });
  plantList.value = res1.data;
};
// 初始化搜索参数数据
const searchParamInit = {
  storageUnitCode: "",
  extenalCode: "",
  materialId: "",
  materialCode: "",
  materialName: "",
  packageMaterialId: "",
  packageMaterialCode: "",
  packageMaterialName: "",
  stockBatch: "",
  supplyBatch: "",
  organizationId: "",
  organizationCode: "",
  organizationName: "",
  plantId: "",
  plantCode: "",
  plantName: "",
  warehouseId: "",
  warehouseCode: "",
  warehouseName: "",
  storageLocationId: "",
  storageLocationCode: "",
  storageLocationName: "",
  storageTypeId: "",
  storageTypeCode: "",
  storageTypeName: "",
  storageSectionId: "",
  storageSectionCode: "",
  binId: "",
  binCode: "",
  totalQuantity: "",
  availableQuantity: "",
  freezeQuantity: "",
  quantityUnit: "",
  usedColume: "",
  usedArea: "",
  usedWeight: "",
  version: "",
  remarks: "",
  createTimeSearch: [],
  createTimeStart: "",
  createTimeEnd: "",
  createdUserId: "",
  createdUserName: "",
  lastUpdateTimeSearch: [],
  lastUpdateTimeStart: "",
  lastUpdateTimeEnd: "",
  lastUpdatedUserId: "",
  lastUpdatedUserName: "",
};

const deleteParam = {
  api: "/wms/storageunit/delete",
  data: {},
};

// 数据请求错误后处理
function requestError() {}

const isExpanded = ref(false);

const dataCallBack = ref(undefined); // 无需二次数据处理&不传赞数也行

// 表格操作 Hooks
const {
  tableData,
  pageable,
  searchParam,
  ids,
  getTableList,
  search,
  reset,
  handleSizeChange,
  handleCurrentChange,
  handleSelectionChange,
  handleTableDelete,
  loading,
}: any = useTable(
  requestApi,
  initParam,
  searchParamInit,
  pagination,
  dataCallBack.value,
  requestError,
  deleteParam
);

const addDialog = reactive<DialogOption>({
  visible: false,
  title: "",
  data: {},
});

// 查询详情
async function getInfo(id: string) {
  const { data } = await request({
    url: `/wms/storageunit/getinfo/${id}`,
    method: "get",
  });
  addDialog.data = data;
}
function toggleSearchArea() {
  isExpanded.value = !isExpanded.value;
}

/** 打开包装单位表单弹窗 详情 */
function openDialogdetail(roleObj?: any) {
  addDialog.title = "包装单位详情";
  getInfo(roleObj.id);
  addDialog.visible = true;
}

function changeVisible(value: boolean) {
  addDialog.visible = value;
  getTableList();
  inputAutoFocus();
  if (!value) {
    addDialog.data = {};
  }
}

function getcreateTime(data: any) {
  if (data) {
    searchParam.value.createTimeStart = data[0];
    searchParam.value.createTimeEnd = data[1];
  } else {
    searchParam.value.createTimeStart = "";
    searchParam.value.createTimeEnd = "";
  }
}
function getlastUpdateTime(data: any) {
  if (data) {
    searchParam.value.lastUpdateTimeStart = data[0];
    searchParam.value.lastUpdateTimeEnd = data[1];
  } else {
    searchParam.value.lastUpdateTimeStart = "";
    searchParam.value.lastUpdateTimeEnd = "";
  }
}

// 进入页面聚焦
const inputRef = ref();
const readonly = ref(true);
const inputAutoFocus = () => {
  nextTick(() => {
    readonly.value = true;
    inputRef.value.focus();
    setTimeout(() => {
      readonly.value = false;
    }, 0);
  });
};

// 触发打印
const IFRAME_URL = import.meta.env.VITE_APP_IFRAME_URL;
const showWebView = ref(false);
const webviewSrc = ref("");
const returnText = ref("");
function confirmImport(id: string, instance: any, done: Function) {
  returnText.value = "";
  webviewSrc.value = `${IFRAME_URL}iframePrintUnit?id=${id}`;
  console.log("webviewSrc.value", webviewSrc.value);
  showWebView.value = true;
  // 设置调用间隔，当打印机被初始化后，提醒用户打印中
  let sumTime = 0;
  let intervalId = setInterval((instance1 = instance, done1 = done) => {
    sumTime += 500;
    if (returnText.value.length) {
      instance1.confirmButtonLoading = false;
      showWebView.value = false;
      done1();
      ElMessage(returnText.value);
      clearInterval(intervalId);
    }
    if (sumTime >= 5000 && !returnText.value) {
      instance1.confirmButtonLoading = false;
      showWebView.value = false;
      done1();
      ElMessage.error("打印失败，请稍后再试");
      clearInterval(intervalId);
    }
  }, 500);
}
const open = (row) => {
  ElMessageBox.confirm(
    `当前外部编号为${row?.extenalCode ?? ""}, 请确认是否打印？`,
    "提示",
    {
      confirmButtonText: "确认",
      cancelButtonText: "取消",
      beforeClose: (action, instance, done) => {
        if (action === "confirm") {
          // 开启按钮加载
          instance.confirmButtonLoading = true;
          // 调用打印页面
          // window.location.href = `${IFRAME_URL}iframePrintUnit?id=${row.id}`;
          isPrint.value = true;
          printId.value = row.id;
          centerDialogVisible.value = true;

          // getPrintData();
          done();
        } else {
          done();
        }
      },
    }
  ).catch(() => {});
};

function handleIframeMessage(event) {
  // 获取从 Vue 组件发送过来的数据
  const receivedData = event.data;
  returnText.value = receivedData;
  // 在这里处理接收到的数据
  console.log("receivedData", receivedData); // 输出传输过来的数据
}

const isPrint = ref(false);
let printId = ref("");
// 打印数据，数组形式
const printData = ref<RootObject[]>([]);

// 定义二维码options
let barOptions = {
  fontSize: 14,
  height: 50,
  fontOptions: "bold",
  textAlign: "center",
  margin: 0,
  width: 2,
  font: "Microsoft YaHei",
  displayValue: false, //是否在条形码下方显示文字
};

// 获取打印数据
async function getPrintData() {
  const { data } = await request({
    url: `/wms/storageunit/getprintinfo/${printId.value}`,
    method: "get",
    data: {},
  }).finally(() => {});
  //printData.value = [data, data, data]; //多张打印
  printData.value = [data]; //单张打印
  // if (printLocation) {
  //   flag.value = printLocation;
  // } else {
  //   centerDialogVisible.value = true;
  // }
  nextTick(() => {
    printData.value?.map(async (e) => {
      const qrCodeId = `barcode_${e?.id || ""}`;
      const qrCodeElement = document.getElementById(qrCodeId);

      if (qrCodeElement) {
        try {
          await QRCode.toCanvas(qrCodeElement, e.extenalCode || "", {
            width: 100, // 可以根据需要调整二维码的大小
            margin: 1, // 可以根据需要调整二维码的边距
          });
        } catch (err) {
          console.error("Error generating QR code:", err);
        }
      }
    });
  });
  setTimeout(() => {
    let LODOP = null;
    console.log("LODOP666", LODOP);
    if (flag.value == "local") {
      // LODOP = getLocalLodop();
      console.log("LODOP,local", LODOP);
    }
    if (flag.value == "distant") {
      LODOP = getLodop();
      console.log("LODOP,distant", LODOP);
    }
    LODOP.PRINT_INIT(`包装打印-${printId.value}`);
    // LODOP.SET_LICENSES(
    //   defaultSettings.printCompany,
    //   defaultSettings.printLicenses,
    //   "",
    //   ""
    // );
    printData.value?.map((e) => {
      printFun(e, LODOP);
    });
    // LODOP.SET_PRINTER_INDEX("ZDesigner ZT231-203dpi ZPL");
    // LODOP.PRINT(); // 打印
    console.log(LODOP.Printers.list);
    isPrint.value = false;
    // LODOP.PREVIEW(); // 预览
    // LODOP.SET_PRINTER_INDEX(route.query.printer); //指定打印设备
    // LODOP.SELECT_PRINTER(); //临时默认选择打印设备
    LODOP.PRINT(); // 打印
    window.parent.postMessage("打印中，请稍后...", "*");
  }, 1000);
}
function printFun(pitem: RootObject, LODOP: any) {
  LODOP.SET_PRINT_PAGESIZE(1, "100mm", "100mm", ""); // 设置纸张类型（方向、宽度、高度、纸张类型名称）
  //LODOP.ADD_PRINT_RECT(0, 5, 310, 220, 0, 1); //边框设置：上、左、宽、高、线条：0实线 1虚线
  //LODOP.SET_PRINT_STYLE("FontSize", 7.5);
  //LODOP.SET_PRINT_STYLE("FontName", "cursive"); // 需要服务端机器安装同样字体，才能生效
  LODOP.ADD_PRINT_HTM(
    "38mm",
    "3mm",
    "100mm",
    "100mm",
    document.getElementById(`printId_${pitem?.id || ""}`)?.innerHTML
  );
  LODOP.ADD_PRINT_BARCODE(
    "3mm",
    "35mm",
    "40mm",
    "40mm",
    "QRCode",
    pitem?.extenalCode || ""
  );
  LODOP.NEWPAGE(); //另起一页
}
//打印地址选择
let printLocation = sessionStorage.getItem("printLocation");
console.log("printLocation", printLocation);
// 对话框显示隐藏
const centerDialogVisible = ref(false);
//打印设置本地与远程
const flag = ref();
function centerDialogVisibleClick() {
  console.log("flag.value", flag.value);
  if (flag.value == "distant") {
    // sessionStorage.removeItem("printLocation");
    // sessionStorage.setItem("printLocation", "distant");
    // printLocation = sessionStorage.getItem("printLocation");
  } else if (flag.value == "local") {
    // sessionStorage.removeItem("printLocation");
    // sessionStorage.setItem("printLocation", "local");
    // printLocation = sessionStorage.getItem("printLocation");
  }
  console.log("确定", printLocation);
  centerDialogVisible.value = false;
  getPrintData();
}
onMounted(() => {
  getTableList();
  inputAutoFocus();
  getPlantList();
  // 添加iframe监听
  window.addEventListener("message", handleIframeMessage);
});

onBeforeUnmount(() => {
  // 销毁iframe监听
  window.removeEventListener("message", handleIframeMessage);
});
</script>
<style lang="scss" scoped>
.app-container {
  height: inherit;
  overflow: scroll;
}
</style>
